home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 114 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.7 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: clamage@Eng.sun.com (Steve Clamage)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Throwing an exception from within a si
  5. Date: 22 Jan 1996 16:23:06 GMT
  6. Organization: Sun Microsystems Inc.
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4e0d5d$47h@engnews1.Eng.Sun.COM>
  9. References: <4dumo5$bav@wcap.centerline.com>
  10. Reply-To: clamage@Eng.sun.com
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. Content-Type: text
  13. X-Nntp-Posting-Host: taumet.eng.sun.com
  14. Content-Length: 1950
  15. X-Lines: 41
  16. Originator: clamage@taumet
  17.  
  18. In article bav@wcap.centerline.com, chase@centerline.com (David Chase) writes:
  19. >
  20. >Use of techniques not mandated by the ABI does not necessarily
  21. >"violate" the ABI.  For instance, Sun's current C++ product uses
  22. >PC-ranges, yet these are not discussed in the ABI.  Note that the C++
  23. >subroutines interoperate with ABI-conforming subroutines.  Placing
  24. >something like that in the ABI merely helps reduce the chance that
  25. >each and every language and vendor will do something different and
  26. >non-interoperable.
  27.  
  28. I'm afraid it does more than that. Suppose PC-ranges are not in the ABI
  29. and a C++ program uses functions (like the C library or the X library or
  30. a database library) which were not written or compiled as C++ and thus do
  31. not have PC-ranges.
  32.  
  33. If an asyncronous signal occurs during execution of a non-C++ routine, and
  34. the signal handler is a C++ routine that throws an exception, what will
  35. happen if the stack is not in a consistent state? 
  36.  
  37. Guarantees in the C++ standard about exceptions in signal handlers would be
  38. tantamount to saying that C++ programs cannot expect to call non-C++ functions.
  39.  
  40. The C standard does not even promise that you can call an arbitrary
  41. function from a signal handler. How can C++ make stronger promises?
  42.  
  43. On a given platform, an implementation may provide documented
  44. behavior for what the standard says is undefined, and in fact that is
  45. often the case. For example, some invalid floating-point operations have
  46. undefined behavior, but many implementations provide well-defined
  47. mechanisms for dealing with FP errors. Most platforms define how pointer
  48. and integer types may be inter-converted. You just can't count on these
  49. things in portable code.
  50.  
  51. Similarly, if it made sense on a given platform to allow arbitrary code in
  52. signal handlers, the implementation could document that fact. Requiring
  53. such from every implementation on every platform is a different story.
  54.  
  55. ---
  56. Steve Clamage, stephen.clamage@eng.sun.com
  57.  
  58.  
  59.  
  60. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  61.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  62.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  63.  
  64.